/**
    @file semant.h
    @brief header for the semantic paser
    
    Functions in semant routine translate var, exp, and dec into their real
    meaning by replacing it with corresponding abstract structure
*/

#ifndef __SEMANT_H__
#define __SEMANT_H__

#include "types.h"
#include "table.h"
#include "absyn.h"
#include "translate.h"

struct expty { Tr_exp exp; Ty_ty ty; };
///Create a new expTy structure
struct expty expTy(Tr_exp exp, Ty_ty ty);

///Translate a given abstract syntax tree
T_stmList    SEM_transProg(A_exp root);

///Translate a given var
struct expty SEM_transVar(S_table venv, S_table tenv, Tr_level level,
                A_var v, Temp_label breakk);
///Translate a given exp
struct expty SEM_transExp(S_table venv, S_table tenv, Tr_level level,
                A_exp v, Temp_label breakk);
///Translate a given dec
struct expty SEM_transDec(S_table venv, S_table tenv, Tr_level level,
                A_dec v, Temp_label breakk);
///Translate a given type
Ty_ty         SEM_transTy (S_table tenv, A_ty a);

#endif
